package dieci.managers.supplier;

import dieci.database.supplier.SupplierHibernateDAO;
import dieci.system.Supplier;
import java.util.List;

/**
 *
 * @author DuckSys
 */
public class SupplierManager
{

    public SupplierManager()
    {
        this.supplierDAO = new SupplierHibernateDAO();
    }

    public void saveSupplier(Supplier supplier)
    {
        //call dao to save the supplier in db
        supplierDAO.saveOrUpdate(supplier);
    }

    public void deleteSupplier(Supplier supplier)
    {
        supplierDAO.delete(supplier);
    }

    public List<Supplier> find(String name)
    {
        return supplierDAO.findBySupplierName(name);
    }

    public Supplier findById(int id)
    {
        return supplierDAO.findBySupplierId(id);
    }
    
    public List<Supplier> list()
    {
        return supplierDAO.list();
    }
    
    private SupplierHibernateDAO supplierDAO;
}
